﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="LessonEditor.aspx.cs" Inherits="LessonEditor" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" DataKeyNames="LessonID,UserID" DataSourceID="test" ForeColor="#333333" GridLines="None" OnSelectedIndexChanged="GridView1_SelectedIndexChanged">
            <AlternatingRowStyle BackColor="White" />
            <Columns>
                <asp:CommandField ShowDeleteButton="True" ShowSelectButton="True" />
                <asp:BoundField DataField="LessonID" HeaderText="LessonID" ReadOnly="True" SortExpression="LessonID" />
                <asp:BoundField DataField="content" HeaderText="content" SortExpression="content" />
                <asp:BoundField DataField="UserID" HeaderText="UserID" ReadOnly="True" SortExpression="UserID" Visible="False" />
            </Columns>
            <EditRowStyle BackColor="#2461BF" />
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#EFF3FB" />
            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#F5F7FB" />
            <SortedAscendingHeaderStyle BackColor="#6D95E1" />
            <SortedDescendingCellStyle BackColor="#E9EBEF" />
            <SortedDescendingHeaderStyle BackColor="#4870BE" />
        </asp:GridView>
        <br />
        <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Add" Width="73px" />
&nbsp;&nbsp;
        <asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="Edit" Width="73px" />
        <br />
        <asp:SqlDataSource ID="test" runat="server" ConflictDetection="CompareAllValues" ConnectionString="<%$ ConnectionStrings:testConnectionString %>" DeleteCommand="DELETE FROM [LessonsContent] WHERE [LessonID] = @original_LessonID AND [UserID] = @original_UserID AND (([content] = @original_content) OR ([content] IS NULL AND @original_content IS NULL))" InsertCommand="INSERT INTO [LessonsContent] ([LessonID], [content], [UserID]) VALUES (@LessonID, @content, @UserID)" OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT [LessonID], [content], [UserID] FROM [LessonsContent] WHERE ([UserID] = @UserID)" UpdateCommand="UPDATE [LessonsContent] SET [content] = @content WHERE [LessonID] = @original_LessonID AND [UserID] = @original_UserID AND (([content] = @original_content) OR ([content] IS NULL AND @original_content IS NULL))">
            <DeleteParameters>
                <asp:Parameter Name="original_LessonID" Type="String" />
                <asp:Parameter Name="original_UserID" Type="String" />
                <asp:Parameter Name="original_content" Type="String" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="LessonID" Type="String" />
                <asp:Parameter Name="content" Type="String" />
                <asp:Parameter Name="UserID" Type="String" />
            </InsertParameters>
            <SelectParameters>
                <asp:SessionParameter DefaultValue="3" Name="UserID" SessionField="UserID" Type="String" />
            </SelectParameters>
            <UpdateParameters>
                <asp:Parameter Name="content" Type="String" />
                <asp:Parameter Name="original_LessonID" Type="String" />
                <asp:Parameter Name="original_UserID" Type="String" />
                <asp:Parameter Name="original_content" Type="String" />
            </UpdateParameters>
        </asp:SqlDataSource>
    
    </div>
    </form>
</body>
</html>
